package j_util.sorters;

import java.util.Comparator;
import java.util.List;

public abstract class AbstractHeapsort extends Sort {
    protected Comparator comparator;

    protected void exchangeTheLeast(int left, int right, List list) {
        int k = left;
        for (int i = left; i <= right; i++) {
            if (less(list.get(i), list.get(k), comparator)) {
                k = i;
            }
        }
        exchange(list, left, k);
    }
}
